package com.qianfeng.smartdevice.mapper;

import com.qianfeng.smartdevice.pojo.SysDevice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by wenka on 2022/3/25 20:08
 *
 * @author Jackiechan
 * @version 1.0
 * @since 1.0
 */
public interface SysDeviceMapper {
    /**
     * 添加新的设备
     * @param device
     */
    @Insert("INSERT INTO sys_device (device_id,device_name,categy_id,bind_user_id,scene_id,bind_time) values (#{deviceId},#{deviceName},#{categyId},#{bindUserId},#{sceneId},#{bindTime})")
    void addSysDevice(SysDevice device);

    /**
     * 根据设备id查询信息
     * @param deviceId
     * @return
     */
    @Select("SELECT * FROM sys_device WHERE device_id =#{deviceId}")
    SysDevice findById(String deviceId);

    /**
     * 更新设备信息
     * @param sysDevice
     * @return
     */
    int updateDeviceById(SysDevice sysDevice);

    /**
     * 查询所有的设备信息
     * @param sysDevice
     * @return
     */
    List<SysDevice> findAll(SysDevice sysDevice);
}
